<header id="topbar" class="affix">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="<%= window.location.href %>">商户详情</a>
            </li>
            <li class="crumb-link">
                <a href="#op/mch/">商户管理</a>
            </li>
            <li class="crumb-trail">商户编辑</li>
        </ol>
    </div>
    <div class="pull-right">
        <a href="javascript:;" class="btn btn-primary btn-sm light fw600 ml10 template-save"><span class="fa fa-save"></span>保存</a>
    </div>
</header>
<section id="content">
    <div class="panel">
        <div class="panel-heading">
            <span class="panel-icon"><i class="fa fa-gear text-primary"></i>
            </span>
            <span class="panel-title">参数设置</span>
        </div>
        <div class="panel-body">
            <form id="template-form" class="form-horizontal">
                <div class="form-group">
                    <label for="inputName" class="col-md-1 control-label">商户名称：</label>
                    <div class="col-md-9">
                        <input type="text" id="inputName" class="form-control" value="<%= info.name %>" placeholder="请输入商户名称..." required>
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputApikey" class="col-md-1 control-label">商户密钥：</label>
                    <div class="col-md-9">
                        <input type="text" maxlength="50" id="inputApikey" class="form-control" value="<%= info.api_key %>" readonly="readonly" placeholder="系统自动生成...">
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputWechatNotifyPrefix" class="col-md-1 control-label">微信回调host：</label>
                    <div class="col-md-9">
                        <input type="text" maxlength="50" id="inputWechatNotifyPrefix" class="form-control" value="<%= info.service_conf.wechat ? info.service_conf.wechat.notify_prefix : '' %>" placeholder="支付回调用到的前缀">
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputWechatChns" class="col-md-1 control-label">微信通道：</label>
                    <div class="col-md-4">
                        <select class="required form-control search-select" id="inputWechatChns" multiple="multiple">
                            <% var wechat_chns = info.service_conf.wechat ? info.service_conf.wechat.chns : []; %>
                            <% _.each(channels, function(channel){ %>
                            <% if (channel.service_name == 'wechat') { %>
                                <option value="<%= channel.id %>" <%= wechat_chns.indexOf(channel.id.toString()) >= 0 ? 'selected' : '' %>><%= channel.name %></option>
                            <% } %>
                            <% }) %>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputAlipayNotifyPrefix" class="col-md-1 control-label">支付宝回调host：</label>
                    <div class="col-md-9">
                        <input type="text" maxlength="50" id="inputAlipayNotifyPrefix" class="form-control" value="<%= info.service_conf.alipay ? info.service_conf.alipay.notify_prefix : '' %>" placeholder="支付回调用到的前缀">
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputAlipayChns" class="col-md-1 control-label">支付宝通道：</label>
                    <div class="col-md-4">
                        <select class="required form-control search-select" id="inputAlipayChns" multiple="multiple">
                            <% var alipay_chns = info.service_conf.alipay ? info.service_conf.alipay.chns : []; %>
                            <% _.each(channels, function(channel){ %>
                            <% if (channel.service_name == 'alipay') { %>
                                <option value="<%= channel.id %>" <%= alipay_chns.indexOf(channel.id.toString()) >= 0 ? 'selected' : '' %>><%= channel.name %></option>
                            <% } %>
                            <% }) %>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputUnionpayChns" class="col-md-1 control-label">银联通道：</label>
                    <div class="col-md-4">
                        <select class="required form-control search-select" id="inputUnionpayChns" multiple="multiple">
                            <% var unionpay_chns = info.service_conf.unionpay ? info.service_conf.unionpay.chns : []; %>
                            <% _.each(channels, function(channel){ %>
                            <% if (channel.service_name == 'unionpay') { %>
                                <option value="<%= channel.id %>" <%= unionpay_chns.indexOf(channel.id.toString()) >= 0 ? 'selected' : '' %>><%= channel.name %></option>
                            <% } %>
                            <% }) %>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputQQChns" class="col-md-1 control-label">qq支付通道：</label>
                    <div class="col-md-4">
                        <select class="required form-control search-select" id="inputQQChns" multiple="multiple">
                            <% var qq_chns = info.service_conf.qq ? info.service_conf.qq.chns : []; %>
                            <% _.each(channels, function(channel){ %>
                            <% if (channel.service_name == 'qq') { %>
                                <option value="<%= channel.id %>" <%= qq_chns.indexOf(channel.id.toString()) >= 0 ? 'selected' : '' %>><%= channel.name %></option>
                            <% } %>
                            <% }) %>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputJDChns" class="col-md-1 control-label">京东支付通道：</label>
                    <div class="col-md-4">
                        <select class="required form-control search-select" id="inputJDChns" multiple="multiple">
                            <% var jd_chns = info.service_conf.jd ? info.service_conf.jd.chns : []; %>
                            <% _.each(channels, function(channel){ %>
                            <% if (channel.service_name == 'jd') { %>
                                <option value="<%= channel.id %>" <%= jd_chns.indexOf(channel.id.toString()) >= 0 ? 'selected' : '' %>><%= channel.name %></option>
                            <% } %>
                            <% }) %>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputRechargeCardChns" class="col-md-1 control-label">充值卡支付通道：</label>
                    <div class="col-md-4">
                        <select class="required form-control search-select" id="inputRechargeCardChns" multiple="multiple">
                            <% var recharge_card_chns = info.service_conf.recharge_card ? info.service_conf.recharge_card.chns : []; %>
                            <% _.each(channels, function(channel){ %>
                            <% if (channel.service_name == 'recharge_card') { %>
                                <option value="<%= channel.id %>" <%= recharge_card_chns.indexOf(channel.id.toString()) >= 0 ? 'selected' : '' %>><%= channel.name %></option>
                            <% } %>
                            <% }) %>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputTestChns" class="col-md-1 control-label">测试通道：</label>
                    <div class="col-md-4">
                        <select class="required form-control search-select" id="inputTestChns" multiple="multiple">
                            <% var test_chns = info.service_conf.test ? info.service_conf.test.chns : []; %>
                            <% _.each(channels, function(channel){ %>
                            <% if (channel.service_name == 'test') { %>
                                <option value="<%= channel.id %>" <%= test_chns.indexOf(channel.id.toString()) >= 0 ? 'selected' : '' %>><%= channel.name %></option>
                            <% } %>
                            <% }) %>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputWithdrawChns" class="col-md-1 control-label">下分通道(支付宝)：</label>
                    <div class="col-md-4">
                        <select class="required form-control search-select" id="inputWithdrawChns" multiple="multiple">
                            <% var withdraw_alipay_chns = info.service_conf.withdraw_alipay ? info.service_conf.withdraw_alipay.chns : []; %>
                            <% _.each(withdraw_channels, function(channel){ %>
                                <option value="<%= channel.id %>" <%= withdraw_alipay_chns.indexOf(channel.id.toString()) >= 0 ? 'selected' : '' %>><%= channel.name %></option>
                            <% }) %>
                        </select>
                    </div>
                </div>
            </form>
        </div>
    </div>

</section>
